home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes ƒ / Circle serendipity.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  1.2 KB  |  46 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define CorrectTime 2
  4. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  5. #define theWindowWidth (boundsRect.right-boundsRect.left)
  6.  
  7. pascal short CircleSerendipity(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  8.  
  9. /* I haven't the slightest idea why this works.  Hence the name.  -MP */
  10.  
  11. pascal short CircleSerendipity(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  12. {
  13.     Rect            theRect;
  14.     RgnHandle        curregion;
  15.     Point            zeropoint;
  16.     short            gap;
  17.     
  18.     gap=theWindowHeight/40;
  19.     SetRect(&theRect, boundsRect.left, boundsRect.top-2*theWindowHeight, boundsRect.right,
  20.         boundsRect.bottom-theWindowHeight);
  21.         
  22.     curregion=NewRgn();
  23.     SetEmptyRgn(curregion);
  24.     OpenRgn();
  25.         FrameOval(&theRect);
  26.     CloseRgn(curregion);
  27.     zeropoint.v=boundsRect.bottom;
  28.     zeropoint.h=boundsRect.left;
  29.     do
  30.     {
  31.         StartTiming();
  32.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  33.                 &boundsRect, &boundsRect, 0, curregion);
  34.         OffsetRgn(curregion, 0, gap);
  35.         TimeCorrection(CorrectTime);
  36.     }
  37.     while (!(PtInRgn(zeropoint, curregion)));
  38.  
  39.     CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  40.             &boundsRect, &boundsRect, 0, 0L);
  41.     
  42.     DisposeRgn(curregion);
  43.     
  44.     return 0;
  45. }
  46.